package org.holdren.jgabriel.model;

import java.io.Serializable;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Entity
@Table(name="service")
@NamedQuery(name="Service.findAll", query="SELECT svc FROM Service svc ")
public class Service implements Serializable
{
	private static final long serialVersionUID = 1L;
	
    @Id
    @GeneratedValue(strategy=GenerationType.AUTO)
    @Column(name="service_id")
    private long id;
    
    @Column(name="date_preached")
    @Temporal(TemporalType.DATE)
    private Date preachedOn;
    
    @Column(name="date_series", length=11)
    private Integer dateSerial;
    
    @Column(length=80)
    private String minister;
    
    @Column(name="subseries_title", length=80)
    private String title;
    
    @Column(name="subseries_part", length=11)
    private Integer part;
    
    @Column(name="series_name", length=80)
    private String seriesName;
    
    @Column(name="series_part", length=11)
    private Integer seriesPart;
    
    @Column(length=100)
    private String location;
    
    @OneToMany(mappedBy="service", cascade=CascadeType.ALL, fetch=FetchType.LAZY)
    private Set<Media> media = new HashSet<Media>();

	public long getId()
	{
		return id;
	}

	public void setId(long id)
	{
		this.id = id;
	}

	public Date getPreachedOn()
	{
		return preachedOn;
	}

	public void setPreachedOn(Date preachedOn)
	{
		this.preachedOn = preachedOn;
	}

	public Integer getDateSerial()
	{
		return dateSerial;
	}

	public void setDateSerial(Integer dateSerial)
	{
		this.dateSerial = dateSerial;
	}

	public String getMinister()
	{
		return minister;
	}

	public void setMinister(String minister)
	{
		this.minister = minister;
	}

	public String getTitle()
	{
		return title;
	}

	public void setTitle(String title)
	{
		this.title = title;
	}

	public Integer getPart()
	{
		return part;
	}

	public void setPart(Integer part)
	{
		this.part = part;
	}

	public String getSeriesName()
	{
		return seriesName;
	}

	public void setSeriesName(String seriesName)
	{
		this.seriesName = seriesName;
	}

	public Integer getSeriesPart()
	{
		return seriesPart;
	}

	public void setSeriesPart(Integer seriesPart)
	{
		this.seriesPart = seriesPart;
	}

	public String getLocation()
	{
		return location;
	}

	public void setLocation(String location)
	{
		this.location = location;
	}

	public Set<Media> getMedia()
	{
		return media;
	}

	public void setMedia(Set<Media> media)
	{
		this.media = media;
	}
    
}
